package com.isorf.mapper;

import com.isorf.pojo.size;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface sizemapper {

    @Select("SELECT * FROM size")
    List<size> getallsize();

    @Update("UPDATE size SET " +
            "shoe_size = #{shoeSize}, " +
            "size_status = #{sizeStatus}, " +
            "size_remarks = #{sizeRemarks} " +
            "WHERE size_id = #{sizeId}")
    int updatesize(size size);

    @Insert("insert into size values (#{sizeId},#{shoeSize},#{sizeStatus},#{sizeRemarks})")
    int addsize(size size);

    @Select("select * from size")
    List<size> pageList();

    @Delete({
            "<script>",
            "DELETE FROM size WHERE size_id IN",
            "<foreach collection='list' item='size_id' open='(' separator=',' close=')'>",
            "#{size_id}",
            "</foreach>",
            "</script>"
    })
    int batchDelete(@Param("list") List<Integer> ids);

    @Delete("delete from size where size_id = #{shoeSize}")
    int deletesize(Integer shoeSize);

    @Delete("DELETE FROM inventorylist WHERE size_id = #{sizeId}")
    int deleteInventoryBySizeId(Integer sizeId);

    @Delete({
            "<script>",
            "DELETE FROM inventorylist WHERE size_id IN",
            "<foreach collection='list' item='id' open='(' separator=',' close=')'>",
            "#{id}",
            "</foreach>",
            "</script>"
    })
    int deleteInventoryBySizeIds(@Param("list") List<Integer> ids);
}
